From f5c8b732a232c2e434199b7afc4bf8af9c5d7fd5 Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Wed, 17 Sep 2014 01:05:18 +0000 Subject: [PATCH] use qPrintable with warning() and fatal() instead of what seems like an arbitrary combination of CSTR and CSTRc. --- gpsbabel/delbin.cc | 22 +++++++++++----------- gpsbabel/dmtlog.cc | 2 +- gpsbabel/exif.cc | 2 +- gpsbabel/garmin_device_xml.cc | 2 +- gpsbabel/gdb.cc | 4 ++-- gpsbabel/ignrando.cc | 4 ++-- gpsbabel/ik3d.cc | 2 +- gpsbabel/kml.cc | 2 +- gpsbabel/navilink.cc | 2 +- gpsbabel/osm.cc | 4 ++-- gpsbabel/ozi.cc | 4 ++-- gpsbabel/pocketfms_wp.cc | 4 ++-- gpsbabel/unicsv.cc | 2 +- 13 files changed, 28 insertions(+), 28 deletions(-) diff --git a/gpsbabel/delbin.cc b/gpsbabel/delbin.cc index 588bd60e7..75628c7e7 100644 --- a/gpsbabel/delbin.cc +++ b/gpsbabel/delbin.cc @@ -1086,7 +1086,7 @@ read_waypoints(void) notes_i = 0; notes_max = 0; if (global_opts.debug_level >= DBGLVL_L) { - warning(MYNAME ": read waypoint '%s'\n", CSTRc(wp->description)); + warning(MYNAME ": read waypoint '%s'\n", qPrintable(wp->description)); } } else if (wp && id == MSG_WAYPOINT_NOTE_OUT) { const msg_waypoint_note_t* p = (const msg_waypoint_note_t*) msg_array[i].data; @@ -1469,7 +1469,7 @@ write_waypoint(const Waypoint* wp) xfree(notes_freeable); } if (global_opts.debug_level >= DBGLVL_L) { - warning(MYNAME ": wrote waypoint %u '%s'\n", waypoint_i, CSTRc(name)); + warning(MYNAME ": wrote waypoint %u '%s'\n", waypoint_i, qPrintable(name)); } } @@ -1584,10 +1584,10 @@ read_track(route_head* track) break; } if (--attempt == 0) { - fatal(MYNAME ": reading track '%s' failed\n", CSTRc(track->rte_name)); + fatal(MYNAME ": reading track '%s' failed\n", qPrintable(track->rte_name)); } if (global_opts.debug_level >= DBGLVL_M) { - warning(MYNAME ": timed out reading track '%s', retrying\n", CSTRc(track->rte_name)); + warning(MYNAME ": timed out reading track '%s', retrying\n", qPrintable(track->rte_name)); } m.size = MSG_BREAK_SIZE; memset(m.data, 0, m.size); @@ -1595,7 +1595,7 @@ read_track(route_head* track) } message_free(&m); if (msg_array_n == 0 || message_get_id(&msg_array[0]) != MSG_TRACK_HEADER_OUT) { - fatal(MYNAME ": reading track '%s' failed (missing track header)\n", CSTRc(track->rte_name)); + fatal(MYNAME ": reading track '%s' failed (missing track header)\n", qPrintable(track->rte_name)); } // process track messages p = (const msg_track_header_t*) msg_array[0].data; @@ -1611,7 +1611,7 @@ read_track(route_head* track) if (id == MSG_TRACK_POINT_OUT) { decode_track_point(msg_array[i].data, &wp_array_i, n_point); } else { - fatal(MYNAME ": unexpected message %x while reading track '%s'\n", id, CSTRc(track->rte_name)); + fatal(MYNAME ": unexpected message %x while reading track '%s'\n", id, qPrintable(track->rte_name)); } message_free(&msg_array[i]); } @@ -1620,7 +1620,7 @@ read_track(route_head* track) fatal(MYNAME ": track point count mismatch, expected %u, got %u\n", n_point, wp_array_i); } if (global_opts.debug_level >= DBGLVL_L) { - warning(MYNAME ": read track '%s' %u points\n", CSTRc(track->rte_name), n_point); + warning(MYNAME ": read track '%s' %u points\n", qPrintable(track->rte_name), n_point); } for (i = 0; i < n_point; i++) { track_add_wpt(track, wp_array[i]); @@ -1962,10 +1962,10 @@ read_route(route_head* route) break; } if (--attempt == 0) { - fatal(MYNAME ": reading route '%s' failed (timed out)\n", CSTRc(route->rte_name)); + fatal(MYNAME ": reading route '%s' failed (timed out)\n", qPrintable(route->rte_name)); } if (global_opts.debug_level >= DBGLVL_M) { - warning(MYNAME ": timed out reading route route '%s', retrying\n", CSTRc(route->rte_name)); + warning(MYNAME ": timed out reading route route '%s', retrying\n", qPrintable(route->rte_name)); } m.size = MSG_BREAK_SIZE; memset(m.data, 0, m.size); @@ -1990,13 +1990,13 @@ read_route(route_head* route) if (id == MSG_ROUTE_POINT_OUT) { wp_array[wp_array_i] = decode_route_point(msg_array[i].data); if (global_opts.debug_level >= DBGLVL_L) { - warning(MYNAME ": route point '%s'\n", CSTRc(wp_array[wp_array_i]->shortname)); + warning(MYNAME ": route point '%s'\n", qPrintable(wp_array[wp_array_i]->shortname)); } wp_array_i++; } else if (id == MSG_ROUTE_SHAPE_OUT) { decode_route_shape(msg_array[i].data, &wp_array_i); } else { - fatal(MYNAME ": unexpected message %x while reading route '%s'\n", id, CSTRc(route->rte_name)); + fatal(MYNAME ": unexpected message %x while reading route '%s'\n", id, qPrintable(route->rte_name)); } message_free(&msg_array[i]); } diff --git a/gpsbabel/dmtlog.cc b/gpsbabel/dmtlog.cc index 0d467e537..a04ead1a4 100644 --- a/gpsbabel/dmtlog.cc +++ b/gpsbabel/dmtlog.cc @@ -151,7 +151,7 @@ static void tlog3a_xgcb_version(xg_string args, const QXmlStreamAttributes*) { if (args != "1") { - fatal(MYNAME ": Unsupported file version '%s'!\n", CSTRc(args)); + fatal(MYNAME ": Unsupported file version '%s'!\n", qPrintable(args)); } } diff --git a/gpsbabel/exif.cc b/gpsbabel/exif.cc index 054329e3e..19a7110b9 100644 --- a/gpsbabel/exif.cc +++ b/gpsbabel/exif.cc @@ -1451,7 +1451,7 @@ exif_write(void) if (exif_wpt_ref == NULL) { warning(MYNAME ": No point with a valid timestamp found.\n"); } else if (abs(exif_time_ref - exif_wpt_ref->creation_time.toTime_t()) > frame) { - warning(MYNAME ": No matching point found for image date %s!\n", CSTR(str)); + warning(MYNAME ": No matching point found for image date %s!\n", qPrintable(str)); if (exif_wpt_ref != NULL) { QString str = exif_time_str(exif_wpt_ref->creation_time.toTime_t()); warning(MYNAME ": Best is from %s, %d second(s) away.\n", diff --git a/gpsbabel/garmin_device_xml.cc b/gpsbabel/garmin_device_xml.cc index 306a38704..4aedab33c 100644 --- a/gpsbabel/garmin_device_xml.cc +++ b/gpsbabel/garmin_device_xml.cc @@ -92,7 +92,7 @@ void dir_s(xg_string args, const QXmlStreamAttributes*) my_gdx_info->to_device.basename = xstrdup(base); my_gdx_info->to_device.extension = xstrdup(ext); } else { - fatal(MYNAME ":Unknown direction '%s'\n", CSTRc(args)); + fatal(MYNAME ":Unknown direction '%s'\n", qPrintable(args)); } if (base) { diff --git a/gpsbabel/gdb.cc b/gpsbabel/gdb.cc index cab77f9e8..ba1621925 100644 --- a/gpsbabel/gdb.cc +++ b/gpsbabel/gdb.cc @@ -842,9 +842,9 @@ read_route(void) warnings++; if (warnings > 3) { - fatal(MYNAME "-rte_pt \"%s\": too many warnings!\n", CSTRc(wpt->shortname)); + fatal(MYNAME "-rte_pt \"%s\": too many warnings!\n", qPrintable(wpt->shortname)); } - warning(MYNAME "-rte_pt \"%s\" (class %d): possible error in route.\n", CSTRc(wpt->shortname), wpt_class); + warning(MYNAME "-rte_pt \"%s\" (class %d): possible error in route.\n", qPrintable(wpt->shortname), wpt_class); warning(MYNAME "-rte_pt (dump):"); for (i = 0; i < 18; i++) { warning(" %02x", (unsigned char)buf[i]); diff --git a/gpsbabel/ignrando.cc b/gpsbabel/ignrando.cc index bd04cceb7..40ca97980 100644 --- a/gpsbabel/ignrando.cc +++ b/gpsbabel/ignrando.cc @@ -125,7 +125,7 @@ ignr_etape_pos(xg_string args, const QXmlStreamAttributes* attrv) ignr_xml_error((wpt == NULL) || (args.isEmpty())); if (2 != sscanf(CSTRc(args), "%lf,%lf", &wpt->latitude, &wpt->longitude)) { - fatal(MYNAME ": Invalid coordinates \"%s\"!\n", CSTRc(args)); + fatal(MYNAME ": Invalid coordinates \"%s\"!\n", qPrintable(args)); } } @@ -138,7 +138,7 @@ ignr_etape_alt(xg_string args, const QXmlStreamAttributes* attrv) } if (1 != sscanf(CSTRc(args), "%lf", &wpt->altitude)) { - fatal(MYNAME ": Invalid altitude \"%s\"!\n", CSTRc(args)); + fatal(MYNAME ": Invalid altitude \"%s\"!\n", qPrintable(args)); } } diff --git a/gpsbabel/ik3d.cc b/gpsbabel/ik3d.cc index 382184ae6..a45b5e781 100644 --- a/gpsbabel/ik3d.cc +++ b/gpsbabel/ik3d.cc @@ -115,7 +115,7 @@ iktobj_type(xg_string args, const QXmlStreamAttributes*) track = route_head_alloc(); break; default: - fatal(MYNAME ": Unknown object type %s!\n", CSTRc(args)); + fatal(MYNAME ": Unknown object type %s!\n", qPrintable(args)); } } diff --git a/gpsbabel/kml.cc b/gpsbabel/kml.cc index 97fbe5b2c..e428a3923 100644 --- a/gpsbabel/kml.cc +++ b/gpsbabel/kml.cc @@ -408,7 +408,7 @@ void gx_trk_coord(xg_string args, const QXmlStreamAttributes*) // It is not clear that coord elements without altitude are allowed, but our // writer produces them. if (0 != n && 2 != n && 3 != n) { - fatal(MYNAME ": gx:coord field decode failure on \"%s\".\n", CSTR(args)); + fatal(MYNAME ": gx:coord field decode failure on \"%s\".\n", qPrintable(args)); } if (n >= 2) { trkpt->latitude = lat; diff --git a/gpsbabel/navilink.cc b/gpsbabel/navilink.cc index 3ff7c2000..1a5a79e43 100644 --- a/gpsbabel/navilink.cc +++ b/gpsbabel/navilink.cc @@ -751,7 +751,7 @@ serial_write_route_end(const route_head* route) rte_name = "NO NAME"; } if (route_id_ptr > MAX_ROUTE_LENGTH) { - fatal(MYNAME ": Route %s too long\n", CSTRc(route->rte_name)); + fatal(MYNAME ": Route %s too long\n", qPrintable(route->rte_name)); } src = (route_id_ptr + MAX_SUBROUTE_LENGTH) / MAX_SUBROUTE_LENGTH; diff --git a/gpsbabel/osm.cc b/gpsbabel/osm.cc index e991dc63d..9db63fc14 100644 --- a/gpsbabel/osm.cc +++ b/gpsbabel/osm.cc @@ -497,7 +497,7 @@ osm_node(xg_string args, const QXmlStreamAttributes* attrv) QString atstr = attrv->value("id").toString(); wpt->description = "osm-id " + atstr; if (waypoints.contains(atstr)) { - warning(MYNAME ": Duplicate osm-id %s!\n", CSTR(atstr)); + warning(MYNAME ": Duplicate osm-id %s!\n", qPrintable(atstr)); } else { waypoints.insert(atstr, wpt); wpt->wpt_flags.fmt_use = 1; @@ -597,7 +597,7 @@ osm_way_nd(xg_string args, const QXmlStreamAttributes* attrv) tmp = new Waypoint(*ctmp); route_add_wpt(rte, tmp); } else { - warning(MYNAME ": Way reference id \"%s\" wasn't listed under nodes!\n", CSTR(atstr)); + warning(MYNAME ": Way reference id \"%s\" wasn't listed under nodes!\n", qPrintable(atstr)); } } } diff --git a/gpsbabel/ozi.cc b/gpsbabel/ozi.cc index 86a6d07bd..444d5d324 100644 --- a/gpsbabel/ozi.cc +++ b/gpsbabel/ozi.cc @@ -749,7 +749,7 @@ data_read(void) datum = GPS_Lookup_Datum_Index(buff); if (datum < 0) { - fatal(MYNAME ": Unsupported datum '%s'.\n", CSTR(buff)); + fatal(MYNAME ": Unsupported datum '%s'.\n", qPrintable(buff)); } } else if (linecount == 3) { if (buff.startsWith( "Altitude is in ", Qt::CaseInsensitive)) { @@ -761,7 +761,7 @@ data_read(void) altunit = 'm'; alt_scale = 1.0; } else { - fatal(MYNAME ": Unknown unit (%s) used by altitude values!\n", CSTR(unit)); + fatal(MYNAME ": Unknown unit (%s) used by altitude values!\n", qPrintable(unit)); } } } else if ((linecount == 5) && (ozi_objective == trkdata)) { diff --git a/gpsbabel/pocketfms_wp.cc b/gpsbabel/pocketfms_wp.cc index 8e68ff852..14b805156 100644 --- a/gpsbabel/pocketfms_wp.cc +++ b/gpsbabel/pocketfms_wp.cc @@ -74,13 +74,13 @@ data_read(void) wpt->shortname = s; s = csv_lineparse(NULL, "\\w", "", linecount); if (!s) { - fatal(MYNAME "Invalid latitude %s", CSTRc(wpt->shortname)); + fatal(MYNAME "Invalid latitude %s", qPrintable(wpt->shortname)); } wpt->latitude = wppos_to_dec(s); s = csv_lineparse(NULL, "\\w", "", linecount); if (!s) { - fatal(MYNAME "Invalid longitude %s", CSTRc(wpt->shortname)); + fatal(MYNAME "Invalid longitude %s", qPrintable(wpt->shortname)); } wpt->longitude = wppos_to_dec(s); waypt_add(wpt); diff --git a/gpsbabel/unicsv.cc b/gpsbabel/unicsv.cc index 2a63ff890..86116b4f4 100644 --- a/gpsbabel/unicsv.cc +++ b/gpsbabel/unicsv.cc @@ -567,7 +567,7 @@ unicsv_fondle_header(const char* ibuf) f++; } if ((! f->name) && global_opts.debug_level) { - warning(MYNAME ": Unhandled column \"%s\".\n", CSTR(s)); + warning(MYNAME ": Unhandled column \"%s\".\n", qPrintable(s)); } /* handle some special items */ -- 2.30.2